home *** CD-ROM | disk | FTP | other *** search
/ Champak 114 / Vol 114.iso / games / beat_the.swf / scripts / DefineSprite_149_mc.readout / frame_5 / DoAction.as
Encoding:
Text File  |  2010-08-12  |  1.5 KB  |  75 lines

  1. this.init = function()
  2. {
  3.    var _loc3_ = this;
  4.    var _loc2_ = _loc3_.attachMovie("mc.number","num_mc",0);
  5.    _loc2_._x = 27;
  6.    _loc2_._y = 4;
  7.    var _loc1_ = 0;
  8.    while(_loc1_ < 3)
  9.    {
  10.       _loc2_ = _loc2_.attachMovie("mc.number","num_mc",0);
  11.       if(_loc1_ == 1)
  12.       {
  13.          _loc2_._x = -17;
  14.       }
  15.       else
  16.       {
  17.          _loc2_._x = -12;
  18.       }
  19.       _loc1_ = _loc1_ + 1;
  20.    }
  21.    _loc3_.pTotal = 0;
  22.    _loc3_.pSpeed = 100;
  23.    _loc3_.pActive = true;
  24.    _loc3_.pMsgSent = false;
  25. };
  26. this.onEnterFrame = function()
  27. {
  28.    var _loc1_ = this;
  29.    if(_loc1_.pActive)
  30.    {
  31.       _loc1_.pTotal += _loc1_.pSpeed;
  32.       _loc1_.num_mc.setTo(_loc1_.pTotal);
  33.       if(_loc1_.pSpeed == 100)
  34.       {
  35.          if(_loc1_.pTotal / 22 >= 900)
  36.          {
  37.             _loc1_.pSpeed = 25;
  38.             _loc1_._parent.slowPump();
  39.          }
  40.       }
  41.       else if(_loc1_.pTotal / 22 >= 1000)
  42.       {
  43.          if(!_loc1_.pMsgSent)
  44.          {
  45.             _loc1_._parent.checkPumpReadout();
  46.             _loc1_.pMsgSent = true;
  47.          }
  48.          else
  49.          {
  50.             _loc1_._parent._parent.scores_mc.addpoints(- _loc1_.pSpeed / 22);
  51.          }
  52.       }
  53.    }
  54. };
  55. this.startReadout = function()
  56. {
  57.    this.pActive = true;
  58. };
  59. this.stopReadout = function()
  60. {
  61.    this.pActive = false;
  62. };
  63. this.resetReadout = function()
  64. {
  65.    var _loc1_ = this;
  66.    _loc1_.pTotal = 0;
  67.    _loc1_.num_mc.setTo(_loc1_.pTotal);
  68. };
  69. this.getTimerTotal = function()
  70. {
  71.    return this.pTotal;
  72. };
  73. this.init();
  74. stop();
  75.